package com.ruoyi.oto.tagvisible;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.oto.domain.BranchMember;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
public class BranchTagVisible {
    /**
     * 可见的职能部门
     */
    private List<String> branchIds;
    /**
     * 职能部门列表
     */
    private List<SysDept> sysDepts;
    /**
     * 可见的联企人员
     */
    private List<String> branchMemberIds;
    /**
     * 联企人员
     */
    private List<BranchMember> branchMembers;


    public BranchTagVisible(List<String> branchIds,List<SysDept> sysDepts,List<String> branchMemberIds,List<BranchMember> branchMembers) {
        this.branchIds = branchIds;
        this.sysDepts = sysDepts;
        if(branchIds!=null && !branchIds.isEmpty()){
           for (SysDept sysDept : sysDepts) {
               if(branchIds.contains(sysDept.getDeptId().toString())){
                   sysDept.setTagVisible(true);
               }
           }
        }
        if(branchMemberIds!=null && !branchMemberIds.isEmpty()){
            for (BranchMember branchMember : branchMembers) {
                if(branchMemberIds.contains(branchMember.getMemberId().toString())){
                    branchMember.setTagVisible(true);
                }
            }
        }
        this.branchMemberIds = branchMemberIds;
        this.branchMembers = branchMembers;
    }
}
